//
//  LZStatusBottomView.swift
//  Weibo
//
//  Created by lzing on 16/3/26.
//  Copyright © 2016年 lzing. All rights reserved.
//

import UIKit

class LZStatusBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        // 添加控件
        addSubview()
        // 添加约束
        addConstraint()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    ///  添加控件
    private func addSubview() {
        addSubview(retweetButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(firstSeparateLine)
        addSubview(secondSeparateLine)
    }
    
    ///  添加约束
    private func addConstraint() {
        // 转发按钮约束
        retweetButton.snp_makeConstraints { (make) -> Void in
            make.left.top.bottom.equalTo(self)
        }
        
        // 评论按钮约束
        commentButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetButton.snp_right)
            make.top.bottom.equalTo(self)
            make.width.equalTo(retweetButton)
        }
        
        // 赞按钮约束
        likeButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentButton.snp_right)
            make.top.bottom.right.equalTo(self)
            make.width.equalTo(commentButton)
        }
        
        // 添加分割线约束
        firstSeparateLine.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(retweetButton.snp_right)
            make.centerY.equalTo(retweetButton)
        }
        
        secondSeparateLine.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_right)
            make.centerY.equalTo(commentButton)
        }
    }
    
    
    //MARK: - lazy
    ///  转发按钮
    private lazy var retweetButton : UIButton = UIButton(title: "转发", imageName: "timeline_icon_retweet")
    
    ///  评论按钮
    private lazy var commentButton : UIButton = UIButton(title: "评论", imageName: "timeline_icon_comment")
    
    ///  赞按钮
    private lazy var likeButton : UIButton = UIButton(title: "赞", imageName: "timeline_icon_unlike")
    
    ///  分割线1
    private lazy var firstSeparateLine : UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    ///  分割线2
    private lazy var secondSeparateLine : UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
}
